package com.example.dataView.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dataView.common.result.R;
import com.example.dataView.pojo.SchoolFever;
import com.example.dataView.mapper.SchoolFeverMapper;
import com.example.dataView.service.SchoolFeverService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 成大事
 * @since 2022-06-12 19:01:25
 */
@Service
public class SchoolFeverServiceImpl extends ServiceImpl<SchoolFeverMapper, SchoolFever> implements SchoolFeverService {

    @Resource
    private SchoolFeverMapper schoolFeverMapper;

    /**
     * 获得高校热度排行榜
     * @return R
     */
    @Override
    public R<Object> getSchoolFeverList() {
        List<Map<String, Object>> maps = schoolFeverMapper.selectMaps(new QueryWrapper<SchoolFever>()
                        .select("city","school_name","num")
                .orderByAsc("serial_number"));
        return R.ok(maps);
    }
}
